<!DOCTYPE html>
<html>
<head><#include "/admin/common/common.ftl" parse=true encoding="utf-8">
</head>
<body class="hold-transition skin-blue sidebar-mini">
	<div class="wrapper">

		<#include "/admin/common/header.ftl" parse=true encoding="utf-8">
		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>模板管理</h1>
				<ol class="breadcrumb">
					<li class="active">邮件模板列表</li>
				</ol>
			</section>
			<!-- Main content -->
			<section class="content">
				<!-- Info boxes -->
				<div class="row">
					<div class="box">
						<div class="box-header">
							<div class="table-btn">
								<a href="${base}/admin/template/mail/addnew.do">
									<span class="label label-primary">新增</span>
								</a>
							</div>
						</div>
						<!-- /.box-header -->
						<div class="box-body">
							<table id="defaultForm" class="table table-striped">
								<thead>
									<tr>
										<th>模板类型</th>
										<th>模板名称</th>
										<th>是否默认</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<#if list??&&(list?size>0)> <#list list as entity>
									<tr>
										<td>${entity.type!}</td>
										<td>${entity.name!}</td>
										<td>${entity.isDefault!}</td>
										<td><a href="javascript:detail(${entity.id!})">
												<span class="label label-primary">详情</span>
											</a> <a href="javascript:modify(${entity.id!})">
												<span class="label label-primary">修改</span>
											</a> <a href="javascript:del(${entity.id!});">
												<span class="label label-danger">删除</span>
											</a></td>
									</tr>
									</#list> <#else>
									<tr>
										<td colspan="20">暂无记录</td>
									</tr>
									</#if>
									<!-- /.box-body -->

								</tbody>
							</table>
						</div>
						<!-- /.box-body -->

					</div>
					<!-- /.box -->
					<#include "/admin/common/pager-auto-reload.ftl" parse=true encoding="utf-8">
				</div>
				<!-- /.row -->
			</section>
			<!-- /.content -->
		</div>
		<!-- /.content-wrapper -->

	</div>
	<!-- ./wrapper -->
	<#include "/admin/common/footer.ftl" parse=true encoding="utf-8">

</body>
<script type="text/javascript">
		
	function del(id) {
		bootbox.setLocale("zh_CN");
		bootbox.confirm("您确认删除选定的记录吗？", function(result) {
			if (result) {
				var url = "${base}/admin/template/mail/delete/" + id + ".do";
				var entity = {
					id : id
				};
				var onloadFunc = function(result) {
					if (result.isSuccess == true) {
						history.go(0);
					} else {
						bootbox.alert("删除失败！");
					}
				};
				httpRequestPostJson(url, entity, false, onloadFunc);
			}
		});
	}

	function detail(id) {
		window.location = '${base}/admin/template/mail/detail/' + id + '.do';
	}

	function modify(id) {
		window.location = '${base}/admin/template/mail/modify/' + id + '.do';
	}
</script>
</html>

